package controllers;

import business.CommonBiz;
import constants.Constants;
import org.apache.commons.lang.StringUtils;
import org.joda.time.DateTime;
import play.*;
import play.mvc.*;

import java.util.*;

import models.*;
import utils.ErrorInfo;
import utils.PageBean;

public class Application extends Controller {

    public static void index() {
        render();
    }

    public static void heimingdan(){
        String strCurrPage = params.get("currPage");
        int currPage = 0;
        int pageSize = 0;
        if(StringUtils.isEmpty(strCurrPage)){
            currPage = 0;
        }else {
            currPage = Integer.parseInt(strCurrPage);
        }

        ErrorInfo error = new ErrorInfo();
        PageBean<heimingdan> pageBean = CommonBiz.queryHeimingdanList(currPage,pageSize,error);
        render(pageBean);
    }

    public static void heimingdan_save(){
        String username = params.get("username");
        String code = "-1";
        String msg = "保存失败";
        if(username!=null){
            heimingdan hmdobj = new heimingdan();
            hmdobj.user_status = 1;
            hmdobj.username = username;
            hmdobj.create_date = new Date();
            hmdobj.save();
            code = "1";
            msg = "保存成功";
        }
        heimingdan();
    }

    //主页
    public static void index1(){
        render("/Application/index1.html");
    }

    //查看评价
    public static void chakanpj(){
        render("/Application/chakanpj.html");
    }

    //批量评价_全部
    public static void piliangpj_all(){
        render("/Application/piliangpj_all.html");
    }

    //中差评监控
    public static void zhongchapingjk(){
        render("/Application/zhongchapingjk.html");
    }

    //短信中心
    public static void duanxinzhx(){
        render("/Application/duanxinzhx.html");
    }

    //评价系统
    public static void pingjiaxit(){
        render("/Application/pingjiaxit.html");
    }

    //批量评价，买家未评
    public static void piliangpj_buyerno(){
        render("/Application/piliangpj_buyerno.html");
    }

    //批量评价，卖家未评
    public static void piliangpj_sellerno(){
        render("/Application/piliangpj_sellerno.html");
    }

    //批量评价_卖家未评买家已评
    public static void piliangpj_sellerno_yes(){
        render("/Application/piliangpj_sellerno_yes.html");
    }

    //批量评价_买家未评卖家已评
    public static void piliangpj_buyerno_yes(){
        render("/Application/piliangpj_buyerno_yes.html");
    }

    //自动定时评价
    public static void dingshipj(){
        render("/Application/dingshipj.html");
    }


    //查看评价-->中评
    public static void chakanpj_zhongp(){
        render("/Application/chakanpj_zhongp.html");
    }

    //查看评价_已改好评
    public static void chakanpj_yigai(){
        render("/Application/chakanpj_yigai.html");
    }
}